// 缓存类
class CatchItem {
  constructor(namespace: string) {
    this.cache[namespace] = {};
  }
  private cache: object | {} = {};
  get(key: string) {
    return this.cache[key];
  }
  set(key: string, value: any) {
    this.cache[key] = value;
    return this.cache[key];
  }
}

class proxyCacheConstructor {
  private static instance: proxyCacheConstructor | null = null;
  private store: object | {} = {};
  public static getInstance() {
    if (!this.instance) {
      this.instance = new proxyCacheConstructor();
    }
    return this.instance;
  }
  public namespace(namespace: string) {
    this.store[namespace] = new CatchItem(namespace);
    return this.store[namespace];
  }
}

const Cache = proxyCacheConstructor.getInstance();

export default Cache;
